# Maintainer:
pkgname=rapidfuzz
pkgver=3.0.0
pkgrel=0
pkgdesc="Rapid fuzzy string matching in C++ using the Levenshtein Distance"
url="https://github.com/maxbachmann/rapidfuzz-cpp"
arch="all"
license="MIT"
makedepends="
	cmake
	samurai
	"
checkdepends="catch2-3"
source="$pkgname-cpp-$pkgver.tar.gz::https://github.com/maxbachmann/rapidfuzz-cpp/archive/refs/tags/v$pkgver.tar.gz
	cstdint.patch
	"
builddir="$srcdir/rapidfuzz-cpp-$pkgver"

case "$CARCH" in
x86)
	# float rounding
	options="!check"
	;;
esac

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DRAPIDFUZZ_BUILD_TESTING="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
c5f20399bd1cfaa057c40cc17be5d730d50c1014553241f80f461a2fa89de670357d17a4f090394170263b09a53aa29238e5eff2caf9064a2a118c42aa14f320  rapidfuzz-cpp-3.0.0.tar.gz
216c5082498830d42d2eb14d3eba35dd08446008916c920db7b55eaf3dd2358f86a61c238315b85fefecf08b9e902dc4db172f91a8479cfd735e53c7b3e03bf5  cstdint.patch
"
